package com.normal.utils.sp

import kotlin.properties.ReadWriteProperty
import kotlin.reflect.KProperty

/**
 *
 *@author jiang create by 2022/11/9 20 26
 */
class SringSetProperty(private val key: String, private val def: Set<String>?) :
    ReadWriteProperty<SpData, Set<String>?> {
    override fun getValue(thisRef: SpData, property: KProperty<*>): Set<String>? {
        return thisRef.mmkv.decodeStringSet(key, def)
    }

    override fun setValue(thisRef: SpData, property: KProperty<*>, value: Set<String>?) {
        thisRef.mmkv.encode(key, value)
    }
}